package com.start.common.mappers;


import com.start.common.vo.CommonDataVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface CommonDataDictMapper {

    @Select("<script>" +
            "select ${labelKey} as label, ${valueKey} as `value`\n" +
            " from ${tableName}\n" +
            " where ${labelKey} is not null\n" +
            " and ${valueKey} is not null\n" +
            " <if test=\"conditionSQL!=null and conditionSQL.length>0\">\n" +
            "     and ${conditionSQL}\n" +
            " </if></script>")
    List<CommonDataVo> getDataMapper(@Param("tableName") String tableName,
                                     @Param("labelKey") String labelKey,
                                     @Param("valueKey") String valueKey,
                                     @Param("conditionSQL") String conditionSQL);

}
